<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="Flatfy Free Flat and Responsive HTML5 Template ">
    <meta name="author" content="">
    <title>快签到系统</title>
    <link href="/css/indexbootstrap.min.css" rel="stylesheet">
    <link href="/css/indexgeneral.css" rel="stylesheet">
    <link href="/css/indexcustom.css" rel="stylesheet">
    <link href="/css/indexowl.carousel.css" rel="stylesheet">
    <link href="/css/indexowl.theme.css" rel="stylesheet">
    <link href="/css/indexstyle.css" rel="stylesheet">
    <link href="/css/indexanimate.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.js"></script>
    <script type="text/javascript" src="/js/owl.carousel.js"></script>
    <script type="text/javascript" src="/js/script.js"></script>
    <script type="text/javascript" src="/js/wow.min.js"></script>
    <script></script>



    <script>
        function showQRCode(){
            if (document.getElementById("QRcode")){
            }
            else {
                $("#code").append('<img id="QRcode" src="" style="display:none;" >');
                $.ajax({
                    type: "GET",
                    url: "/getimgname",
                    dataType: 'String',
                    success: function (data_1) {
                        console.log(data_1);
                        $("#QRcode").attr("src","../QRcode/code.jpg");
                        var pic=document.getElementById('QRcode');
                        pic.style.display='block';
                    },
                    error:function(data_2){
                        console.log(data_2);
                        var img_name = data_2.responseText;
                        $("#QRcode").attr("src","../QRcode/"+img_name+".jpg");
                        var pic=document.getElementById('QRcode');
                        pic.style.display='block';
                    }

                });
            }



        }

        function getQRcode(){
            $.ajax({
                type: "GET",
                url: "/createqrcode",
                dataType: 'json',
                success: function () {
                }
            });
        }

        function deleteQRcode(){
            $.ajax({
                type: "GET",
                url: "/deleteqrcode",
                dataType: 'json',
                success: function (data) {
                    $("#QRcode").remove();
                },
                error:function(){
                    $("#QRcode").remove();
                }
            });


        }
    </script>
    <style>
        #code{
            display: inline-block;
            vertical-align: middle;
        }
        #QRcode{
            width: 190px;
            height: 190px;
        }
    </style>
</head>
<body id="home">

<div id="preloader">
    <div id="status"></div>
</div>

<div class="intro-header">
    <div class="col-xs-12 text-center abcen1">
        <h1 class="h1_home wow fadeIn" data-wow-delay="0.4s">快点名签到系统</h1>
        <h2 class="h1_home wow fadeIn" data-wow-delay="0.4s"><div id="code"><img id="QRcode" src="" style="display:none;" ></div></h2>
        <h3 class="h3_home wow fadeIn" data-wow-delay="0.6s">Clean & minimal Theme</h3>
        <ul class="list-inline intro-social-buttons">

            <li><a onclick="showQRCode()" class="btn  btn-lg mybutton_cyano wow fadeIn" data-wow-delay="0.8s"><span
                    class="network-name">开始点名</span></a>
            </li>

            <li id=""><a onclick="getQRcode()" class="btn  btn-lg mybutton_standard wow swing wow fadeIn"
                                 data-wow-delay="1.2s"><span class="network-name">生成二维码</span></a>
            </li>
            <li id="download"><a onclick="deleteQRcode()" class="btn  btn-lg mybutton_standard wow swing wow fadeIn"
                                 data-wow-delay="1.2s"><span class="network-name">结束点名</span></a>
            </li>
        </ul>
    </div>
    <div class="col-xs-12 text-center abcen wow fadeIn">
        <div class="button_down ">
            <a class="imgcircle wow bounceInUp" data-wow-duration="1.5s" href="/result"> <img class="img_scroll"
                                                                                              src="img/icon/circle.png"
                                                                                              alt=""> </a>
        </div>
    </div>
</div>
</body>
</html>